<template>
<div>
  <div style="height:500px;margin-top:50px;display:inline-block;">
    <el-menu
      default-active="1-4-1"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      :collapse="isCollapse"
    >
      <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-s-goods"></i>
          <span slot="title">服饰</span>
        </template>
        <el-menu-item-group>
          <span slot="title">衣服</span>
          <el-menu-item index="1-1" @click="getdata($event)">男装</el-menu-item>
          <el-menu-item index="1-2" @click="getdata($event)">女装</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group title="鞋袜">
          <el-menu-item index="1-3" @click="getdata($event)">袜子</el-menu-item>
        </el-menu-item-group>
        <el-submenu index="1-4">
          <span slot="title">鞋</span>
          <el-menu-item index="1-4-1" @click="getdata($event)">男鞋</el-menu-item>
          <el-menu-item index="1-4-2" @click="getdata($event)">女鞋</el-menu-item>
        </el-submenu>
      </el-submenu>
      <el-submenu index="2">
        <template slot="title">
          <i class="el-icon-lollipop"></i>
          <span slot="title">零食</span>
        </template>
        <el-menu-item-group>
          <span slot="title">乳饮品</span>
          <el-menu-item index="2-1" @click="getdata($event)">牛奶</el-menu-item>
          <el-menu-item index="2-2" @click="getdata($event)">饮料</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group title="健康轻零食">
          <el-menu-item index="2-3" @click="getdata($event)">趣味食玩</el-menu-item>
        </el-menu-item-group>
        <el-submenu index="2-4">
          <span slot="title">方便速食</span>
          <el-menu-item index="2-4-1" @click="getdata($event)">方便面</el-menu-item>
          <el-menu-item index="2-4-2" @click="getdata($event)">火腿肠</el-menu-item>
          <el-menu-item index="2-4-3" @click="getdata($event)">甜品罐头</el-menu-item>
          <el-menu-item index="2-4-4" @click="getdata($event)">煎饼冷面</el-menu-item>
          <el-menu-item index="2-4-5" @click="getdata($event)">熟食</el-menu-item>
          <el-menu-item index="2-4-6" @click="getdata($event)">午餐肉</el-menu-item>
        </el-submenu>
      </el-submenu>
      <el-submenu index="3">
        <template slot="title">
          <i class="el-icon-mobile-phone"></i>
          <span slot="title">数码</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="3-1" @click="getdata($event)">手机</el-menu-item>
          <el-menu-item index="3-2" @click="getdata($event)">摄像机</el-menu-item>
          <el-menu-item index="3-3" @click="getdata($event)">U盘</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="4">
        <template slot="title">
          <i class="el-icon-table-lamp"></i>
          <span slot="title">家居</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="4-1" @click="getdata($event)">绿植宠物</el-menu-item>
          <el-menu-item index="4-2" @click="getdata($event)">居家日用</el-menu-item>
          <el-menu-item index="4-3" @click="getdata($event)">家具装饰</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
  <div style="width:1000px; margin-top:50px; float:right; margin-right:300px;">
      <template>
            <el-carousel indicator-position="outside" type="card" height="200px">
            <el-carousel-item v-for="item in imgSrc" :key="item.index">
            <el-image :src="item" fit="contain" class="image">
            </el-image>
            </el-carousel-item>
            </el-carousel>
      </template>
  </div>
</div>
</template>
<style>
  .el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
  }
  .el-carousel__item h3 {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    line-height: 300px;
    margin: 0;
  }
  
  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }
  
  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }
</style>
<script>
  export default {
    data() {
      return {
        isCollapse: true,
        imgSrc:["http://img95.699pic.com/element/40074/2069.png_860.png","http://img95.699pic.com/photo/40010/2839.jpg_wh860.jpg","http://img95.699pic.com/photo/40174/5313.jpg_wh860.jpg","http://img95.699pic.com/photo/40076/0874.jpg_wh860.jpg","http://img95.699pic.com/element/40074/2124.png_860.png","http://img95.699pic.com/photo/40163/5597.jpg_wh860.jpg"]
      }
    },
    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      getdata($event){
          console.log($event._props.index);
      }
    }
  }
</script>